import { GET_GOOD_LIST,GET_GOOD_UPLOAD,GET_GOOD_DESTAIL,GOOD_INIT } from '../actionTypes'
const initstate = {
    goodlist:[],
    total:0,
    cates: [],
    num:0,
    info:{}
}
export default (state=initstate,action)=>{
    let newstate = JSON.parse(JSON.stringify(state))
    switch (action.type) {
        case GET_GOOD_LIST:
        newstate.goodlist = action.payload.list
        newstate.total = action.payload.total
            break;
        case GET_GOOD_UPLOAD :
        newstate.num++
            break
        case GET_GOOD_DESTAIL:
            newstate.info =action.payload
            break
        case GOOD_INIT:
            newstate.info = {}
            newstate.num = 0
            break
            
        default:
            break;
    }
    return newstate

}